package com.nuoniu.sibanyun.controller.crm;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.nuoniu.sibanyun.common.result.HttpResult;
import com.nuoniu.sibanyun.entity.dto.CrmFollowAnalysis;
import com.nuoniu.sibanyun.service.crm.ICrmCustomerService;
import io.swagger.annotations.Api;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * 客户统计分析
 * @auther 小啊刚
 * @date 2020-08-06
 */
@RestController
@RequestMapping("crm/statistics")
@Api(tags = "客户统计分析")
public class CrmStatisticalAnalysisController {

    @Autowired
    private ICrmCustomerService customerService;

    /**
     * 客户跟进分析
     * @author 小啊刚
     * @date 2020-08-06
     */
    @GetMapping("/followAnalysis")
    public HttpResult followAnalysis(Page page, CrmFollowAnalysis analysis) {
        Page<Map> pageData = customerService.followAnalysis(page, analysis);
        return HttpResult.ok(pageData);
    }

    /**
     * 客户分析数据
     * @author 小啊刚
     * @date 2020-08-08
     */
    @GetMapping("/crmAnalysisTable")
    public HttpResult crmAnalysisTable(CrmFollowAnalysis analysis) {
        Map analysisList = customerService.crmAnalysisTable(analysis);
        return HttpResult.ok(analysisList);
    }
}
